{% extends "system_setup/base.html" %}

{% block page_link %}
    <script src="../../static/system_setup/js/base.js"></script>
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link rel="stylesheet" type="text/css" href="../../static/personal_center/css/index.css">
    <link rel="stylesheet" type="text/css" href="../../static/personal_center/css/common.css">
    <script type="text/javascript" src="../../static/personal_center/js/index.js"></script>
{% endblock %}

{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }

        #add_order {
            float: right;
            height: 30px;
            margin-top: 5px;
            margin-right: 10px;
            background: #00a0e9;
            color: white;
            line-height: 14px;
            width: 80px;
            border: #00a0e9 solid 1px;
            border-radius: 3px;
            padding: 8px;
        }

        .tab_top {
            width: 100px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            display: inline-block;
            cursor: pointer;
        }
    </style>
{% endblock %}

{% block right_content %}
    <div style="display: inline-block;vertical-align: top;width: 100%;height: 100%;">
        <div class="headline">
            <div id="db" class="tab_top">定义表单</div>
            <a href="javascript:;" style="text-decoration: none;"
               onclick="admin_add('添加表单','admin-add','1200','800')"><span
                    class="l" id="add_order">创建表单</span></a>
        </div>

        <div id="my_application" style="width: 100%;height: 95.3%;overflow: auto;background-color: white;">
            <div class="right-box" style="width: 100%;height: 100%;margin-top: 0;">
                <div style="height: 100%;width: 100%;overflow: auto;border-bottom: #cccccc solid 1px;background-color: white;">
                    <section class="grid-main">
                        <table id="main_table"></table>
                    </section>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" src="../../static/system_setup/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="../../static/system_setup/js/H-ui.js"></script>
    <script type="text/javascript" src="../../static/system_setup/js/H-ui.admin.page.js"></script>
    <script type="text/javascript" src="../../static/system_setup/laypage/1.2/laypage.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("loading").style.display = "none";
            document.getElementById("process-manage").style.display = "inline-block";
            document.getElementById("jiantou3").className = "iconfont icon-jiantou-xia";
            document.getElementById("process_definition").className = "add_class";
            document.getElementById("system-management").className = "add-nav-active";
        }

        const gridManagerName = "test",
            TYPE_MAP = {1: "HTML/CSS", 2: "nodeJS", 3: "javaScript", 4: "前端鸡汤", 5: "PM Coffee", 6: "前端框架", 7: "前端相关"},
            arg = {
                gridManagerName: "test",
                width: "100%",
                height: "100%",
                autoOrderConfig: {fixed: "left"},
                checkboxConfig: {key: "id", fixed: "left"},
                supportAjaxPage: !0,
                sortMode: "single",
                supportMenu: !0,
                menuHandler: e => (e.unshift({
                    content: "自定义菜单", line: !0, onClick: e => {
                        alert(e)
                    }
                }), e),
                useCellFocus: !0,
                useHideRow: !0,
                supportMoveRow: !0,
                moveRowConfig: {
                    key: "priority", useSingleMode: !0, fixed: "left", handler: (e, t) => {
                        console.log(e, t)
                    }
                },
                disableCache: !1,
                ajaxData: function (e, t) {
                    var local_host = window.location.host;          // 获取当前IP
                    return "/system-setup/user-defined"
                },
                exportConfig: {
                    fileName: e => {
                        const t = new Date;
                        let a = `${t.getFullYear()}-${t.getMonth() + 1}-${t.getDate()}`;
                        for (let t in e) a = `${a}-${t}=${e[t]}`;
                        return a
                    }, suffix: "xls"
                },
                ajaxType: "POST",
                responseHandler: e => (e.data.forEach((e => {
                    e.priority = e.id
                })), e),
                rowRenderHandler: (e, t) => e,
                emptyTemplate: e => `<div style="text-align: center;">${e.query.title ? "搜索为空" : "暂无数据"}</div>`,
                columnData: [
                    {
                        key: "name",
                        text: "流程编号",
                        align: "center",
                        disableMoveRow: !0
                    }, {
                        key: "apply_user",
                        text: "创建人",
                        align: "center",
                    }, {
                        key: "create_time",
                        text: "创建时间",
                        align: "center",
                    }, {
                        key: "module",
                        text: "所属模块",
                        align: "center",
                    }, {
                        key: "action",
                        width: "100px",
                        align: "center",
                        fixed: "right",
                        disableMoveRow: !0,
                        disableRowCheck: !0,
                        text: '<span style="color: red">操作</span>',
                        template: (e, t) => `<a class="plugin-action" id="${t.id}" href="#" onclick="admin_add('查看模板','customer_form_detail_view?id=${t.id}','1200','800')">查看</a>`
                    }]
            }, demo1 = {
                initSearch: function () {
                }, initFN: () => {

                }, initGM: function () {
                    new window.GridManager(table, arg, (e => {
                        console.log("渲染完成后的回调函数:", e), console.log(arg.columnData)
                    }))
                }, editRowData: function (e) {
                    window.GridManager.updateRowData("test", "id", {
                        id: window.parseInt(e.getAttribute("data-id")),
                        lastDate: (new Date).getTime()
                    })
                }
            }, table = document.querySelector("#main_table");
        demo1.initSearch(table), demo1.initGM(table), demo1.initFN();
    </script>
{% endblock %}